package com.hnust.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface ModifyScoreDao {
    /**
     * 插入分数
     * @param studentId 学生id
     * @param testId 考试id
     */
    @Update("update result_detail set test_stu_score=#{newTestStuScore},total_score=#{newTotalScore} where studentId = #{studentId} and testId = #{testId}")
    public int UpdateTestStuScore (String studentId,String testId,String newTestStuScore,double newTotalScore);

    /**
     * 查询分数
     * @param studentId 学生id
     * @param testId 考试id
     */
    @Select("select test_stu_score from result_detail where studentId = #{studentId} and testId = #{testId}")
    public String queryTestStuScore (String studentId, String testId);
}
